#include "sprite.h"

namespace sprite{

index::index(){

	this->max=0;
	
}

index::index(const indexset* list, const unsigned max){

	this->LoadIndex(list, max);

}

index::~index(){

	if(this->list){

		free(this->list);

	}

}

void index::GetMaxIndex(unsigned& max)const{

	max=this->max;

}

void index::GetCurrentIndex(indexset*& list ,unsigned& max) const{

	unsigned i;

	for(i=0;i<max;i++){

		list[i].currentkind=this->list[i].currentkind;
		list[i].currentx=this->list[i].currentx;
		list[i].currenty=this->list[i].currenty;
		list[i].currentwidth=this->list[i].currentwidth;
		list[i].currentheight=this->list[i].currentheight;

	}

}

void index::LoadIndex(const indexset* list, const unsigned max){

	unsigned i=0;

	this->list=(indexset*)malloc(sizeof(indexset)*max);

	this->max=max;

	for(i=0;i<max;i++){

		this->list[i].currentkind=list[i].currentkind;
		this->list[i].currentx=list[i].currentx;
		this->list[i].currenty=list[i].currenty;
		this->list[i].currentwidth=list[i].currentwidth;
		this->list[i].currentheight=list[i].currentheight;
	
	}

}

}